/* Hawk - An OSGI Based Test Framework
 *
 * Copyright (C) 2010 http://code.google.com/p/hawk-framework/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
package org.hawk.core.interfaces;

import java.util.logging.Logger;

import org.hawk.core.model.Input;

/**
 * This interface is responsible standardize the service methods of each bundle. 
 * So, to be a test service a bundle must implement two methods: execute and 
 * getBundleInterface. The execute method triggers the service of a test 
 * bundle, while a getBundleInterface returns a XML representing the inputs 
 * interface of a bundle     
 * 
 * @author Rodrigo Prestes Machado
 * @version November 16, 2009
 */
public interface TestService {
	
	/**
	 * Triggers the service of a test bundle. It receives a input object end a 
	 * log object. The input object will contain information about the parameters
	 * to execute a service inside a bundle. Parameters can be an URL, a content
	 * of a file, a boolean, etc. The return of this method is a result of service
	 * processing. Note: each bundle will contain only one service installed in 
	 * OSGI container      
	 * 
	 * @param An input object 
	 * @param The logger of all system
	 * @return Returns the result of service processing
	 * @throws Exception
	 */
	public abstract String execute(Input input, Logger logger) throws Exception;
	
	/**
	 * This method returns a XML that represents a graphical interface of a 
	 * service inputs. For example:
	 * 
	 * <?xml version='1.0' encoding='UTF-8'?>
	 * <bundle-gui name='org.hawk.bundles.hello.Hello'>
	 *     <input>
	 *         <parameter label='Text:' description='A simple Text' />
	 *     </input>
	 * </bundle-gui>
	 * 
	 * @return A graphical interface of service inputs in XML format of a bundle.
	 * @throws Exception
	 */
	public abstract String getBundleInterface() throws Exception;
	
}
